﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;

public partial class product_info : System.Web.UI.Page
{
    public string ProductId = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (RequestBase.GetQueryString("productid") != "")
                Initialize();

        }
    }

    #region 数据初始化
    void Initialize()
    {
        Model.ProductBase _obj = BLL.ProductBase.GetProductObjById(RequestBase.GetQueryString("productid"));
        ProductObj = _obj;
    }

    Model.ProductBase ProductObj
    {

        set
        {
            if (value != null)
            {
                lblProductName.InnerText = value.ProductName.Trim();
                lblBrandType.InnerText = value.PowerStorageorNot;
                lblCountry.InnerText = value.WarrantyInfo;
                lblCategory.InnerText = value.CategoryName.Trim();
                lblGrape.InnerText = value.Approvals;
                lblCapacity.InnerText = value.Power;
                lblPrice.InnerText = value.MarketPrice.ToString();
                lbldescription.InnerHtml = value.Description;
                lblPrice2_1.InnerText = lblPrice2.InnerText = value.Price.ToString("F0");
                lblAmount.InnerText = value.StockAmount.ToString();
                txtProductId.Value = value.ProductId;
                ProductId = value.ProductId;

                var attach = BLL.AttachmentsBase.GetAttachments(value.ProductId);
                if (attach.Length > 0)
                {
                    var FirstPicturePath_G = attach[0].FilePath;
                    midImg.Src = "_filebase/productimages" + FirstPicturePath_G;
                }
                else
                {
                    midImg.Src = "_filebase/productimages" + (value.TitlePicture == string.Empty ? value.TitlePicture : value.TitlePicture.Split('*')[1]);
                }


            }
        }
    }

    #endregion
}